<!-- studyCuorseDoc.html -->
<!-- http://wenku.baidu.com/view/fc45ac8825c52cc58ad6be1c.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>Mocc课程文档章节</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
		<link rel="stylesheet" href="../../css/base.css"/>
<!--		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">-->
		<style type="text/css">
			/*公共css*/
			#footer {
				height: 50px;
				width: 100%;
			}
			.title_bulk {
				width: 60px;
				height: 44px;
				color: white;
			}
			:focus {
				outline: 0;
			}
			* {
				-webkit-tap-highlight-color: rgba(255,255,255,0);
			}
			input, textarea {
				-webkit-appearance: none;
				border-radius: 0;
			}
			#nav_title {
				white-space: nowrap;
				-o-text-overflow: ellipsis;
				text-overflow: ellipsis;
			}
			.studyed {
				color: #09bb07;
			}
			#studyed_btn {
				visibility: hidden;
			}
		</style>
		<script src="../../script/jquery.min.js"></script>
	</head>
	<body>
<!--		<div class="base_style_color " id='BarAppearance' style="height: 22px;width: 100%"></div>-->
		<div id="header" class="base_navigation_bar base_style_color base_navigation_item_bar">
			<a class="base_left_item" href="#" onclick="onBackClick()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span id="nav_title">文档课程</span>
			<a class="base_right_item base_hide_item"> </a>
		</div>
		<div id="footer"></div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/databaseOperation.js"></script>
	<script type="text/javascript">
		var docUrl;
		var dataFunType = '0';
		var scaleDocFrame;
		var getparam;
		DBReady = function() {
			api.setFullScreen({
				fullScreen: true
			});
			sendBuriedNotifi('0', 'mooc文档', '010');
			orientationData();
			getparam = api.pageParam;
			var navtitle = getparam.title;
			var doc = getparam.doc;
			doc = doc.replace("bcs.duapp.com/cfnetdoc", "cfnetdoc.cfnet.org.cn/bizs");
			doc = doc.replace("bj.bcebos.com/cfnet", "bos.cfnet.org.cn");
			//返回大于等于0的整数值，若不包含".pdf"则返回"-1。
			if (doc.indexOf("bos.cfnet.org.cn") >= 0) {
				docUrl = "http://vip.ow365.cn/?"+(doc.indexOf("https://")>=0?"ssl=1&":"")+"i=5607&n=3&furl=" + doc;
			} else {
				var type = doc.indexOf(".PDF");
				var type2 = doc.indexOf(".pdf");
				var type3 = doc.indexOf(".txt");
				var type4 = doc.indexOf(".TXT");
				if (type >= 0 || type2 >= 0 || type3 >= 0 || type4 >= 0) {//包含pdf
					if (doc.indexOf("http://") >= 0) {
						docUrl = "http://vip.ow365.cn/?ssl=1&i=5607&n=3&furl=" + doc;
					} else {
						docUrl = "http://vip.ow365.cn/?"+(doc.indexOf("https://")>=0?"ssl=1&":"")+"i=5607&n=3&furl=http://bos.cfnet.org.cn" + doc;
					}
				} else {
					if (doc.indexOf("http://") >= 0) {
						doc = doc.replace('http://', '');
						docUrl = "https://view.officeapps.live.com/op/view.aspx?src=" + doc;
					} else {
						docUrl = "https://view.officeapps.live.com/op/view.aspx?src=bos.cfnet.org.cn" + doc;
					}
				}
			}
			console.log("is_encr:"+docUrl);
			$api.text($api.byId('nav_title'), navtitle);
			var y =$('.base_navigation_bar').height();
			var h = api.winHeight - y;
			// var y = document.getElementById('header').offsetHeight;
			// var y = $('#header').height();
			api.openFrame({
				name : 'docFrame',
				url : docUrl,
				bounces : false,
				rect : {
					x : 0,
					y : y,
					w : 'auto',
					h : 'auto'
				},
				progress : {//设置进度条类型和样式
					type : 'page',
					color : '#18b4ed'
				},
				scaleEnabled : true,
				allowEdit : true,
				bgColor : "#fff"
			});

			api.setScreenOrientation({
				orientation: 'auto_landscape'
			});
			// var jsfun = 'scaleDocFrame();';
			// api.execScript({
			//     frameName: 'docFrame',
			//     script: jsfun
			// });
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
				onBackClick();
			});
		}
		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				uname : $api.getStorage('cfnetppusername'),
				cid : api.pageParam.cid,
				pid : api.pageParam.pid,
				vid : api.pageParam.vid
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}

		//横竖屏切换//
		function orientationData() {
			api.setScreenOrientation({
				orientation : 'auto'
			});
		}

		function onBackClick() {
			if(getparam.pushType != 'teacher'){
				// api.sendEvent({
				// 	name: 'StudyWebBaiDuDocBackNotifi',
				// 	extra:{
				// 		studyParam:api.pageParam
				// 	}
				// });
				sendBuriedNotifi('1', 'mooc文档', '010');
			}

			api.setScreenOrientation({
				orientation : 'portrait_up'
			});
			api.setFullScreen({
				fullScreen: false
			});
			api.closeWin();
		}

		function scaleDocFrame() {
			document.write('<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>');
		}
	</script>
</html>